﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Gronia.WPF;
namespace Gronia.Test
{
    /// <summary>
    /// Interaction logic for AlignedWrapPanelTest.xaml
    /// </summary>
    public partial class HyperPanelTest : Window
    {
        public HyperPanelTest()
        {
            InitializeComponent();
        }

        private void Checked(object sender, RoutedEventArgs e)
        {
            if (IsLoaded)
            {
                if (chkHorizontal.IsChecked.Value)
                    panel.Orientation = Orientation.Horizontal;
                else
                    panel.Orientation = Orientation.Vertical;

                if (chkApplyOpacity.IsChecked.Value)
                    panel.ApplyOpacity = true;
                else
                    panel.ApplyOpacity = false;
            }
        }

        private void RadioButton_Checked(object sender, RoutedEventArgs e)
        {
            if (IsLoaded)
            {
                if (etMouse.IsChecked.Value)
                {
                    panel.EffectType = HyperPanelEffectType.Mouse;
                    btnRastgeleChild.Visibility = Visibility.Collapsed;
                    btnRastgeleNokta.Visibility = Visibility.Collapsed;
                }
                else if (etChild.IsChecked.Value)
                {
                    panel.EffectType = HyperPanelEffectType.Child;
                    btnRastgeleChild.Visibility = Visibility.Visible;
                    btnRastgeleNokta.Visibility = Visibility.Collapsed;
                }
                else if (etPoint.IsChecked.Value)
                {
                    panel.EffectType = HyperPanelEffectType.Point;
                    btnRastgeleChild.Visibility = Visibility.Collapsed;
                    btnRastgeleNokta.Visibility = Visibility.Visible;
                }
            }
        }

        Random random = new Random();
        private void btnRastgeleNokta_Click(object sender, RoutedEventArgs e)
        {
            panel.Center = random.NextDouble();
            btnRastgeleNokta.Content = "Rastgele Nokta : " + panel.Center;
        }

        private void btnRastgeleChild_Click(object sender, RoutedEventArgs e)
        {
            int r = random.Next(0, panel.Children.Count);
            panel.HyperChild = panel.Children[r];
            btnRastgeleChild.Content = "Rastgele Child : " + r;
        }

        private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (IsLoaded)
            {
                panel.Distribution = e.NewValue / 100;
            }
        }
    }
}
